/**
 * @author Just、倾城
 * @created 2025-11-04
 * @description
 *
 */
public class PricingChainManager {
    private PricingHandler firstHandler;

    public PricingChainManager() {
        // 创建并连接处理器链
        MorningPricingHandler morning = new MorningPricingHandler();
        AfternoonPricingHandler afternoon = new AfternoonPricingHandler();
        NightPricingHandler night = new NightPricingHandler();

        morning.setNext(afternoon);
        afternoon.setNext(night);
        firstHandler = morning;
    }

    public double calculatePrice(double distance, String time, String taxiType) {
        return firstHandler.handleRequest(distance, time, taxiType);
    }
}
